﻿
function showpagenum(pagelistfunction, totalRecordCount, pageIndex, pageCount, PageNum, ShowNumCount) {
    var showCount = 5;//显示多少个页数码
    var first = 1;
    var prev = pageIndex - 1 == 0 ? 1 : pageIndex - 1;//上一页
    var next = pageIndex == pageCount ? pageCount : pageIndex + 1;//下一页
    if (pageCount < 1) pageCount = 1;
    var PageHtml = "<div class=\"Page-foot\">";
    PageHtml += "<div class=\"PagList\">";
    PageHtml += "<div class=\"pagrecord\"> 记录数：" + totalRecordCount + " 条 &nbsp;&nbsp;页数：" + pageIndex + "/" + pageCount + " </div>";
    PageHtml += "<ul class=\"pagination\"><li><a href =\"javascript:;\" onclick=\"goToPage(1)\"> 首页 </a></li></ul>";
    PageHtml += "<ul class=\"pagination\"><li><a href =\"javascript:;\" onclick=\"goToPage(" + prev + ")\"> 上一页 </a></li></ul>";

    if (ShowNumCount == true) {
        PageHtml += PageNum;
    }
    PageHtml += "<ul class=\"pagination\"><li><a href =\"javascript:;\" onclick=\"goToPage(" + next + ")\"> 下一页 </a></li></ul>";
    PageHtml += "<ul class=\"pagination\"><li><a href =\"javascript:;\" onclick=\"goToPage(" + pageCount + ")\"> 尾页 </a></li></ul>";
    if (pageIndex > showCount) {
        PageHtml += "<ul class=\"pagination\"><li><input type='number' id='txt_PageNo' name='txt_PageNo' style='width:40px;' />&nbsp;<input type='button' onclick='goToPage(document.getElementById(\"txt_PageNo\").value)' id='but_page' name='but_page' value='Go'/></li></ul>";
    }
    PageHtml += "<input type='hidden' id='hid_pagefunction' name='hid_pagefunction' value='" + pagelistfunction + "' />";
    PageHtml += "</div><div  class=\"pagend\">&nbsp;</div> </div>";
    PageHtml += "<div></div>";
    document.getElementById("pagenum").innerHTML = PageHtml;
}


function goToPage(IPage) {
    document.getElementById("hid_pageindex").value = IPage;
    var funname = document.getElementById("hid_pagefunction").value;
    eval(funname + "()");//执行func_abc()函数
}
